<template>
  <div>
    动态路由
  </div>
</template>

<script>
// 引入所有的路由-array
import { asyncRoutes } from '@/router/index'
export default {
  computed: {
    menus() {
      return this.$store.state.user.userInfo.roles.menus
    }
  },
  created() {
    this.filterRoutes(this.menus)
  },
  methods: {
    // 获取menus-array

    // 过滤路由
    filterRoutes(menus) {
      console.log(menus)
      const newRoutes = asyncRoutes.filter((item) => {
        return menus.includes(item.name)
      })
      console.log(newRoutes)
      return newRoutes
    }
  }

}
</script>

<style>

</style>
